timsort: Avoid a crash
authorMatthias Clasen <mclasen@redhat.com>
Fri, 24 Jul 2020 23:22:12 +0000 (19:22 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 24 Jul 2020 23:23:18 +0000 (19:23 -0400)
We need to clear the pointer after freeing the data,
since the sortlistmodel keeps its timsort structure
around and reuses it.

gtk/gtktimsort.c

index f3595b01bc7b5866d2285a9a7824d7c6d9a4a586..7aadef0dda44c18508775f704ec2a96f14e309d9 100644 (file)
@@ -85,7 +85,7 @@ gtk_tim_sort_init (GtkTimSort       *self,
 void
 gtk_tim_sort_finish (GtkTimSort *self)
 {
-  g_free (self->tmp);
+  g_clear_pointer (&self->tmp, g_free);
 }
 
 void